
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>一、网络通讯基础 · 计算机笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="海拉尔的三角">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro-fixed/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex-pro/katex.min.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-terminull-light/terminull.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="tcp_udp_withNum.html" />
    
    
    <link rel="prev" href="../tcp_upd.html" />
    

    
        <link rel="shortcut icon" href="image/ico.png" type="image/x-icon">
    
    
    
    
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="image/ico.png">
    
    
        
    
    
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://github.com/spite-triangle" target="_blank" class="custom-link">Github</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../cpp/cpp.html">
            
                <a href="../../cpp/cpp.html">
            
                    
                    C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../../cpp/chapter/foundation_withNum.html">
            
                <a href="../../cpp/chapter/foundation_withNum.html">
            
                    
                    一、基础概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../../cpp/chapter/keyword_withNum.html">
            
                <a href="../../cpp/chapter/keyword_withNum.html">
            
                    
                    二、关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../../cpp/chapter/point_reference_withNum.html">
            
                <a href="../../cpp/chapter/point_reference_withNum.html">
            
                    
                    三、指针与引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../../cpp/chapter/oop_withNum.html">
            
                <a href="../../cpp/chapter/oop_withNum.html">
            
                    
                    四、面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../../cpp/chapter/memory_withNum.html">
            
                <a href="../../cpp/chapter/memory_withNum.html">
            
                    
                    五、内存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../../cpp/chapter/process_withNum.html">
            
                <a href="../../cpp/chapter/process_withNum.html">
            
                    
                    六、进程与线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../../cpp/chapter/locks_withNum.html">
            
                <a href="../../cpp/chapter/locks_withNum.html">
            
                    
                    七、锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="../../cpp/chapter/stl_withNum.html">
            
                <a href="../../cpp/chapter/stl_withNum.html">
            
                    
                    八、STL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="../../cpp/chapter/dataStruction_withNum.html">
            
                <a href="../../cpp/chapter/dataStruction_withNum.html">
            
                    
                    九、数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="../../cpp/chapter/array_list_withNum.html">
            
                <a href="../../cpp/chapter/array_list_withNum.html">
            
                    
                    十、数组链表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="../../cpp/chapter/find_withNum.html">
            
                <a href="../../cpp/chapter/find_withNum.html">
            
                    
                    十一、目标查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="../../cpp/chapter/tree_withNum.html">
            
                <a href="../../cpp/chapter/tree_withNum.html">
            
                    
                    十二、树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="../../cpp/chapter/binaryTree_withNum.html">
            
                <a href="../../cpp/chapter/binaryTree_withNum.html">
            
                    
                    十三、二叉树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="../../cpp/chapter/dynamicProgram_withNum.html">
            
                <a href="../../cpp/chapter/dynamicProgram_withNum.html">
            
                    
                    十四、动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="../../cpp/chapter/backtracking_withNum.html">
            
                <a href="../../cpp/chapter/backtracking_withNum.html">
            
                    
                    十五、回溯算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="../../cpp/chapter/monotoneStack_withNum.html">
            
                <a href="../../cpp/chapter/monotoneStack_withNum.html">
            
                    
                    十六、单调栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="../../cpp/chapter/toollib_withNum.html">
            
                <a href="../../cpp/chapter/toollib_withNum.html">
            
                    
                    附录 工具库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../../MySQL/mysql.html">
            
                <a href="../../MySQL/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../../MySQL/chapter/introduction_withNum.html">
            
                <a href="../../MySQL/chapter/introduction_withNum.html">
            
                    
                    一、简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../../MySQL/chapter/foundation_withNum.html">
            
                <a href="../../MySQL/chapter/foundation_withNum.html">
            
                    
                    二、控制台操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../../MySQL/chapter/operatorDB_withNum.html">
            
                <a href="../../MySQL/chapter/operatorDB_withNum.html">
            
                    
                    三、数据库、表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../../MySQL/chapter/operatorData_withNum.html">
            
                <a href="../../MySQL/chapter/operatorData_withNum.html">
            
                    
                    四、数据操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../../MySQL/chapter/transaction_withNum.html">
            
                <a href="../../MySQL/chapter/transaction_withNum.html">
            
                    
                    五、事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="../../MySQL/chapter/index_withNum.html">
            
                <a href="../../MySQL/chapter/index_withNum.html">
            
                    
                    六、索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7" data-path="../../MySQL/chapter/authority_withNum.html">
            
                <a href="../../MySQL/chapter/authority_withNum.html">
            
                    
                    七、权限管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8" data-path="../../MySQL/chapter/backup_withNum.html">
            
                <a href="../../MySQL/chapter/backup_withNum.html">
            
                    
                    八、备份
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../linux/linux.html">
            
                <a href="../../linux/linux.html">
            
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../../linux/chapter/foundation_withNum.html">
            
                <a href="../../linux/chapter/foundation_withNum.html">
            
                    
                    一、原理知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../../linux/chapter/command_withNum.html">
            
                <a href="../../linux/chapter/command_withNum.html">
            
                    
                    二、指令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../tcp_upd.html">
            
                <a href="../tcp_upd.html">
            
                    
                    网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="5.1.1" data-path="foundation_withNum.html">
            
                <a href="foundation_withNum.html">
            
                    
                    一、网络通讯基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="tcp_udp_withNum.html">
            
                <a href="tcp_udp_withNum.html">
            
                    
                    二、tcp/udp
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >一、网络通讯基础</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#&#x7F51;&#x7EDC;&#x57FA;&#x7840;"><b></b>&#x7F51;&#x7EDC;&#x57FA;&#x7840;</a></li><li><span class="title-icon "></span><a href="#1-&#x57FA;&#x7840;&#x6982;&#x5FF5;"><b></b>1. &#x57FA;&#x7840;&#x6982;&#x5FF5;</a></li><ul><li><span class="title-icon "></span><a href="#11-ip-&#x5730;&#x5740;"><b></b>1.1. IP &#x5730;&#x5740;</a></li><li><span class="title-icon "></span><a href="#12-&#x5B50;&#x7F51;&#x63A9;&#x7801;"><b></b>1.2. &#x5B50;&#x7F51;&#x63A9;&#x7801;</a></li><li><span class="title-icon "></span><a href="#13-&#x7AEF;&#x53E3;"><b></b>1.3. &#x7AEF;&#x53E3;</a></li><li><span class="title-icon "></span><a href="#14-&#x57DF;&#x540D;"><b></b>1.4. &#x57DF;&#x540D;</a></li><li><span class="title-icon "></span><a href="#15-&#x7F51;&#x5173;"><b></b>1.5. &#x7F51;&#x5173;</a></li><li><span class="title-icon "></span><a href="#16-socket"><b></b>1.6. socket</a></li><li><span class="title-icon "></span><a href="#17-mac"><b></b>1.7. MAC</a></li></ul><li><span class="title-icon "></span><a href="#2-&#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;"><b></b>2. &#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;</a></li><li><span class="title-icon "></span><a href="#3-&#x5355;&#x81C2;&#x8DEF;&#x7531;"><b></b>3. &#x5355;&#x81C2;&#x8DEF;&#x7531;</a></li><li><span class="title-icon "></span><a href="#4-tcpip"><b></b>4. TCP/IP</a></li><ul><li><span class="title-icon "></span><a href="#41-tcpip-&#x534F;&#x8BAE;&#x6A21;&#x578B;"><b></b>4.1. TCP/IP &#x534F;&#x8BAE;&#x6A21;&#x578B;</a></li><li><span class="title-icon "></span><a href="#42-&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;"><b></b>4.2. &#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;</a></li></ul><li><span class="title-icon "></span><a href="#5-tcp&#x534F;&#x8BAE;"><b></b>5. TCP&#x534F;&#x8BAE;</a></li></ul></div><a href="#&#x7F51;&#x7EDC;&#x57FA;&#x7840;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 style="font-size:60px;text-align:center;" id="&#x7F51;&#x7EDC;&#x57FA;&#x7840;"><a name="&#x7F51;&#x7EDC;&#x57FA;&#x7840;" class="anchor-navigation-ex-anchor" href="#&#x7F51;&#x7EDC;&#x57FA;&#x7840;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7F51;&#x7EDC;&#x57FA;&#x7840;</h1>

<h1 id="1-&#x57FA;&#x7840;&#x6982;&#x5FF5;"><a name="1-&#x57FA;&#x7840;&#x6982;&#x5FF5;" class="anchor-navigation-ex-anchor" href="#1-&#x57FA;&#x7840;&#x6982;&#x5FF5;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x57FA;&#x7840;&#x6982;&#x5FF5;</h1>
<p></p><div class="terminull">
    <div class="terminullMenu">
      <div class="terminullButtons terminullClose"></div>
      <div class="terminullButtons terminullMinimize"></div>
      <div class="terminullButtons terminullZoom"></div>
    </div>
    <div class="terminullScreen">
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">cat /etc/network/interfaces</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`cat /etc/network/interfaces`)"></i>
          <span class="terminullOutput">auto eth0

iface eth0 inet static

address 192.168.3.250                 # ip
netmask 255.255.255.0                  #&#x5B50;&#x7F51;&#x63A9;&#x7801;

gateway 192.168.3.1                      #&#x7F51;&#x5173;

dns-nameservers 8.8.8.8 8.8.4.4    #&#x8BBE;&#x7F6E;dns&#x670D;&#x52A1;&#x5668;</span>
        
    </div>
</div><p></p>
<h2 id="11-ip-&#x5730;&#x5740;"><a name="11-ip-&#x5730;&#x5740;" class="anchor-navigation-ex-anchor" href="#11-ip-&#x5730;&#x5740;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. IP &#x5730;&#x5740;</h2>
<blockquote>
<p>[!tip]</p>
<ul>
<li><strong>&#x6982;&#x5FF5;&#xFF1A;&#x7528;&#x4E8E;&#x552F;&#x4E00;&#x6807;&#x8BC6;&#x7F51;&#x7EDC;&#x4E2D;&#x7684;&#x6BCF;&#x53F0;&#x8BA1;&#x7B97;&#x673A;</strong></li>
<li><strong>&#x6307;&#x4EE4;&#xFF1A;</strong> <code>ifconfig</code></li>
<li><strong>IP&#x8868;&#x793A;&#xFF1A;</strong><ul>
<li><code>IPV4:</code>: 4 &#x4E2A;&#x5B57;&#x8282;&#xFF0C;32 &#x4F4D;&#xFF0C;&#x5341;&#x8FDB;&#x5236;&#x8868;&#x793A;&#xFF0C;<code>xx,xx,xx,xx</code>&#xFF0C;<code>xx</code>&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x5B57;&#x8282;<code>0 - 255</code></li>
<li><code>IPV6</code>: 16 &#x4E2A;&#x5B57;&#x8282;&#xFF0C;128&#x4F4D;&#xFF0C;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#xFF0C;IPV4&#x7684;&#x6700;&#x5927;&#x95EE;&#x9898;&#x8D44;&#x6E90;&#x6709;&#x9650;&#xFF0C;IPV6&#x5C31;&#x662F;&#x7528;&#x6765;&#x6269;&#x5C55;&#x8D44;&#x6E90;&#x7684;</li>
</ul>
</li>
<li><strong>IP&#x7684;&#x7EC4;&#x6210;&#xFF1A;</strong> &#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D; + &#x300C;&#x4E3B;&#x673A;&#x5730;&#x5740;&#x300D;&#xFF0C;&#x4F8B;&#x5982; 192.168.16.96 = 192.168.16.0 + 96</li>
</ul>
</blockquote>
<p><strong><code>IPV4</code>&#x5206;&#x7C7B;&#xFF1A;</strong></p>
<p style="text-align:center;"><a href="../../image/tcp_ip/ipv4.png" data-lightbox="d5ce1eee-e5d8-4496-928a-b94f4c61bf1c" data-title="undefined"><img src="../../image/tcp_ip/ipv4.png" alt="undefined"></a></p>

<table>
<thead>
<tr>
<th>&#x7C7B;&#x522B;</th>
<th>&#x8303;&#x56F4;</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>0.0.0.0~127.255.255.255</td>
</tr>
<tr>
<td>B</td>
<td>128.0.0.0~191.255.255.255</td>
</tr>
<tr>
<td>C</td>
<td>192.0.0.0~223.255.255.255</td>
</tr>
<tr>
<td>D</td>
<td>224.0.0.0~239.255.255.255</td>
</tr>
<tr>
<td>E</td>
<td>240.0.0.0~255.255.255.255</td>
</tr>
</tbody>
</table>
<h2 id="12-&#x5B50;&#x7F51;&#x63A9;&#x7801;"><a name="12-&#x5B50;&#x7F51;&#x63A9;&#x7801;" class="anchor-navigation-ex-anchor" href="#12-&#x5B50;&#x7F51;&#x63A9;&#x7801;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. &#x5B50;&#x7F51;&#x63A9;&#x7801;</h2>
<blockquote>
<p>[!tip]
<strong>&#x4F5C;&#x7528;&#xFF1A;&#x5C31;&#x662F;&#x5C06;&#x67D0;&#x4E2A;IP&#x5730;&#x5740;&#x5212;&#x5206;&#x6210;&#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D;&#x548C;&#x300C;&#x4E3B;&#x673A;&#x5730;&#x5740;&#x300D;&#x4E24;&#x90E8;&#x5206;&#x3002;</strong></p>
</blockquote>
<pre class="language-"><code>address 192.168.1.8    
netmask 255.255.255.0
</code></pre><p>IP&#x5730;&#x5740;&#x901A;&#x8FC7;&#x4E0E;&#x63A9;&#x7801;&#x8FDB;&#x884C;&#x300C;&#x4E0E;&#x300D;&#x8FD0;&#x7B97;&#x53EF;&#x4EE5;&#x628A;IP&#x62C6;&#x5206;&#x4E3A;&#xFF1A;<code>192.168.1.0</code> &#x4E0E; <code>8</code></p>
<ul>
<li><code>192.168.1.0</code>: &#x7F51;&#x7EDC;&#x5730;&#x5740;&#xFF08;&#x7F51;&#x6BB5;&#x5730;&#x5740;&#xFF09;&#xFF0C;&#x5C31;&#x662F;&#x4E92;&#x8054;&#x7F51;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x300C;&#x5C40;&#x57DF;&#x7F51;&#x300D;</li>
<li><code>8</code>: &#x4E3B;&#x673A;&#x5730;&#x5740;&#xFF0C;&#x4EE3;&#x8868;&#x4E86;&#x4E00;&#x4E2A;&#x300C;&#x5C40;&#x57DF;&#x7F51;&#x300D;&#x4E0B;&#x7684;&#x4E3B;&#x673A;&#x3002;</li>
<li><strong><code>255.255.255.0</code>: &#x6700;&#x540E;&#x4E00;&#x5B57;&#x8282;&#x4E3A;<code>0</code>&#xFF0C;&#x300C;&#x4E3B;&#x673A;&#x5730;&#x5740;&#x300D;&#x53D6;&#x503C;&#x8303;&#x56F4;&#x5C31;&#x662F;<code>0 - 255</code>&#xFF0C;&#x5176;&#x4E2D;<code>192.168.1.0</code>&#x662F;&#x300C;&#x7F51;&#x6BB5;&#x5730;&#x5740;&#x300D;&#x548C;<code>192.168.1.255</code>&#x662F;&#x300C;&#x5E7F;&#x64AD;&#x5730;&#x5740;&#x300D;&#x8FD9;&#x4E24;&#x4E2A;IP&#x4E0D;&#x80FD;&#x7528;&#x4E8E;&#x8868;&#x793A;&#x8BA1;&#x7B97;&#x673A;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x5728;&#x8BE5;&#x63A9;&#x7801;&#x4E0B;&#x53EA;&#x80FD;&#x5B58;&#x5728;<code>253</code>&#x53F0;&#x4E3B;&#x673A;&#x3002;</strong></li>
</ul>
<h2 id="13-&#x7AEF;&#x53E3;"><a name="13-&#x7AEF;&#x53E3;" class="anchor-navigation-ex-anchor" href="#13-&#x7AEF;&#x53E3;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x7AEF;&#x53E3;</h2>
<blockquote>
<p>[!tip]
<strong>&#x4F5C;&#x7528;&#xFF1A; &#x7528;&#x6765;&#x6807;&#x8BB0;&#x4E00;&#x4E2A;&#x8FDB;&#x7A0B;&#x7684;&#xFF0C;&#x8BA9;&#x5916;&#x90E8;&#x8FDE;&#x63A5;&#x80FD;&#x8BC6;&#x522B;&#x5230;&#x3002;</strong><code>PID</code>&#x53F7;&#x662F;&#x53D8;&#x52A8;&#x7684;&#xFF0C;&#x6BCF;&#x6B21;&#x542F;&#x52A8;&#x90FD;&#x4E0D;&#x4E00;&#x6837;&#xFF0C;&#x53EA;&#x80FD;&#x5728;&#x7528;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x56FA;&#x5B9A;&#x7684;&#x7F16;&#x53F7;&#xFF0C;&#x6765;&#x6807;&#x8BB0;&#x8FDB;&#x7A0B;&#xFF0C;&#x8FD9;&#x6837;&#x5916;&#x90E8;&#x8FDB;&#x6765;&#x7684;&#x8FDE;&#x63A5;&#x624D;&#x80FD;&#x51C6;&#x5907;&#x627E;&#x5230;&#x8FD9;&#x4E2A;&#x8FDB;&#x7A0B;&#x3002;
<strong>&#x6570;&#x91CF;&#xFF1A;</strong> &#x6700;&#x591A; <code>65535</code>&#x4E2A;&#x3002;</p>
</blockquote>
<p style="text-align:center;"><a href="../../image/tcp_ip/portDistribute.png" data-lightbox="43ab2954-60a7-4bdf-93c8-410c77138372" data-title="undefined"><img src="../../image/tcp_ip/portDistribute.png" alt="undefined"></a></p>

<p><strong>&#x7AEF;&#x53E3;&#x5206;&#x914D;&#xFF1A;</strong></p>
<ul>
<li><strong>&#x670D;&#x52A1;&#x5668;&#xFF1A;</strong> &#x7AEF;&#x53E3;&#x53F7;&#x624B;&#x52A8;&#x8BBE;&#x5B9A;&#xFF0C;&#x591A;&#x4E2A;&#x7528;&#x6237;&#x8FDE;&#x63A5;&#x670D;&#x52A1;&#x5668;&#x7684;&#x4E00;&#x4E2A;&#x670D;&#x52A1;&#x8FDB;&#x7A0B;&#xFF0C;&#x53EA;&#x6D88;&#x8017;&#x670D;&#x52A1;&#x5668;&#x7684;&#x4E00;&#x4E2A;&#x7AEF;&#x53E3;&#x3002;</li>
<li><strong>&#x5BA2;&#x6237;&#x7AEF;&#xFF1A;</strong> &#x968F;&#x673A;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#xFF0C;&#x5BA2;&#x6237;&#x7AEF;&#x4E0A;&#x7684;&#x4E00;&#x4E2A;&#x5BA2;&#x6237;&#x8FDB;&#x7A0B;&#x5C31;&#x8981;&#x6D88;&#x8017;&#x4E00;&#x4E2A;&#x7AEF;&#x53E3;&#xFF0C;&#x6709;&#x4E24;&#x4E2A;&#x5BA2;&#x6237;&#x8FDB;&#x7A0B;&#x5C31;&#x6D88;&#x8017;&#x4E24;&#x4E2A;&#x7AEF;&#x53E3;&#x3002;</li>
</ul>
<h2 id="14-&#x57DF;&#x540D;"><a name="14-&#x57DF;&#x540D;" class="anchor-navigation-ex-anchor" href="#14-&#x57DF;&#x540D;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. &#x57DF;&#x540D;</h2>
<blockquote>
<p>[!tip]</p>
<ul>
<li><strong>&#x57DF;&#x540D;&#xFF08;Domain Name&#xFF09;: &#x662F;&#x7531;&#x4E00;&#x4E32;&#x5B57;&#x7B26;&#x7EC4;&#x6210;&#x7684;&#xFF0C;&#x57DF;&#x540D;&#x6307;&#x5411;&#x67D0;&#x4E00;&#x4E2A;IP&#x5730;&#x5740;&#x3002;</strong></li>
<li><strong><code>DNS</code>: &#x57DF;&#x540D;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x53EF;&#x4EE5;&#x5230;&#x57DF;&#x540D;&#x670D;&#x52A1;&#x5668;(&#x4F8B;&#x5982;&#xFF0C;&#x8C37;&#x6B4C; 8.8.8.8)&#x4E0A;&#x53BB;&#x67E5;&#x8BE2;&#x5BF9;&#x5E94;&#x57DF;&#x540D;&#x7684;&#x771F;&#x5B9E;<code>IP</code>&#x3002;</strong></li>
</ul>
</blockquote>
<h2 id="15-&#x7F51;&#x5173;"><a name="15-&#x7F51;&#x5173;" class="anchor-navigation-ex-anchor" href="#15-&#x7F51;&#x5173;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. &#x7F51;&#x5173;</h2>
<p style="text-align:center;"><a href="../../image/tcp_ip/network.png" data-lightbox="f1ef7d92-b517-4572-855c-25ab9a70597c" data-title="undefined"><img src="../../image/tcp_ip/network.png" alt="undefined"></a></p>

<blockquote>
<p>[!tip]</p>
<ul>
<li><strong>&#x4F5C;&#x7528;&#xFF1A;&#x7F51;&#x5173;(Gateway)&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x5230;&#x53E6;&#x4E00;&#x4E2A;&#x7F51;&#x7EDC;&#x7684;&#x300C;&#x5173;&#x53E3;&#x300D;&#x3002;</strong></li>
<li>&#x4E24;&#x4E2A;&#x300C;&#x7EA2;&#x5706;&#x4E3B;&#x673A;&#x300D;&#x60F3;&#x8981;&#x901A;&#x8BAF;&#xFF0C;&#x5C31;&#x9700;&#x8981;&#x4ECE;&#x4E92;&#x8054;&#x7F51;&#x8FD9;&#x4E2A;&#x300C;&#x56FE;&#x300D;&#x4E2D;&#x627E;&#x5230;&#x4E00;&#x6761;&#x76F8;&#x4E92;&#x8FDE;&#x63A5;&#x7684;&#x300C;&#x8DEF;&#x5F84;&#x300D;&#x3002;&#x5BF9;&#x4E8E;&#x8FD9;&#x4E2A;&#x8DEF;&#x5F84;&#xFF0C;&#x5728;&#x4E3B;&#x673A;&#x4E2D;&#x5B58;&#x4E0B;&#x6574;&#x4E2A;&#x4E92;&#x8054;&#x7F51;&#x7684;&#x300C;&#x56FE;&#x300D;&#xFF0C;&#x7136;&#x540E;&#x7528;&#x7B97;&#x6CD5;&#x627E;&#x51FA;&#x4E00;&#x4E2A;&#x8DEF;&#x5F84;&#xFF0C;&#x8FD9;&#x4E2A;&#x662F;&#x4E0D;&#x53EF;&#x80FD;&#x7684;&#x3002;&#x6240;&#x4EE5;&#x6362;&#x4E86;&#x4E00;&#x4E2A;&#x601D;&#x8DEF;&#xFF1A;<strong>&#x5F53;&#x524D;&#x4E3B;&#x673A;&#x53EA;&#x8BB0;&#x5F55;&#xFF0C;&#x4E0B;&#x4E00;&#x4E2A;&#x8DF3;&#x8F6C;&#x7684;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x70B9;&#x5728;&#x54EA;&#x513F;&#x3002;</strong></li>
<li><strong><code>IP</code>&#x8DEF;&#x7531;&#x8868;&#xFF1A;</strong> &#x5B58;&#x50A8;&#x4E86;&#x672C;&#x5730;&#x8BA1;&#x7B97;&#x673A;&#x53EF;&#x4EE5;&#x5230;&#x8FBE;&#x7684;&#x7F51;&#x7EDC;&#x76EE;&#x7684;&#x5730;&#x5740;&#x8303;&#x56F4;&#x548C;&#x5982;&#x4F55;&#x5230;&#x8FBE;&#x7684;&#x8DEF;&#x7531;&#x4FE1;&#x606F;&#x3002;</li>
</ul>
</blockquote>
<p></p><div class="terminull">
    <div class="terminullMenu">
      <div class="terminullButtons terminullClose"></div>
      <div class="terminullButtons terminullMinimize"></div>
      <div class="terminullButtons terminullZoom"></div>
    </div>
    <div class="terminullScreen">
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">route -n</span>
           
            <span class="terminullComment"># &#x67E5;&#x770B;&#x8DEF;&#x7531;&#x8868;</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`route -n`)"></i>
          <span class="terminullOutput">Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.56.0    0.0.0.0         255.255.255.0   U     256    0        0 eth2
0.0.0.0         192.168.1.1     0.0.0.0         U     0      0        0 wifi0</span>
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">ping www.baidu.com</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`ping www.baidu.com`)"></i>
          <span class="terminullOutput">PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=52 time=49.1 ms
....</span>
        
    </div>
</div><p></p>
<p><strong>&#x4E0A;&#x9762;<code>ping</code>&#xFF0C;&#x67E5;&#x627E;&#x7F51;&#x5173;&#x6B65;&#x9AA4;&#xFF1A;</strong></p>
<ol>
<li><code>39.156.66.14</code>&#x548C;<code>route -n</code>&#x7B2C;&#x4E00;&#x884C;&#x7684; <code>Genmask&#xFF1A;255.255.255.0</code>&#x8FDB;&#x884C; &#x300C;&#x4E0E;&#x300D;&#x8FD0;&#x7B97;</li>
<li>&#x8BA1;&#x7B97;&#x7ED3;&#x679C;&#x4E3A;<code>39.156.66.0</code>&#x4E0E;&#x7B2C;&#x4E00;&#x884C;&#x7684;<code>Destination: 192.168.56.0</code>&#x8FDB;&#x884C;&#x6BD4;&#x8F83;&#xFF0C;&#x4E0D;&#x4E00;&#x6837;</li>
<li>&#x6362;<code>route -n</code>&#x7B2C;&#x4E8C;&#x884C;&#xFF0C;&#x91CD;&#x590D;&#x6B65;&#x9AA4;1&#x548C;&#x6B65;&#x9AA4;2</li>
<li>&#x53D1;&#x73B0;&#x7B2C;&#x4E8C;&#x884C;&#x6EE1;&#x8DB3;&#x8981;&#x6C42;&#xFF0C;&#x8FD9;&#x6837;&#x4E0B;&#x4E00;&#x6B21;&#x7684;&#x8DF3;&#x8F6C;&#x70B9;&#x5C31;&#x662F;<code>gateway: 192.168.1.1</code></li>
</ol>
<h2 id="16-socket"><a name="16-socket" class="anchor-navigation-ex-anchor" href="#16-socket"><i class="fa fa-link" aria-hidden="true"></i></a>1.6. socket</h2>
<blockquote>
<p>[!tip]
<strong>&#x5B9A;&#x4E49;&#xFF1A;&#x670D;&#x52A1;&#x7AEF; <code>ip:port</code> &#x4E0E; &#x5BA2;&#x6237;&#x7AEF;<code>ip:port</code>&#x5EFA;&#x7ACB;&#x7684;&#x8FDE;&#x63A5;&#xFF1B;&#x8FD9;&#x4E2A;&#x8FDE;&#x63A5;&#x662F;&#x72EC;&#x7ACB;&#x9694;&#x79BB;&#x7684;&#x3002;</strong></p>
</blockquote>
<h2 id="17-mac"><a name="17-mac" class="anchor-navigation-ex-anchor" href="#17-mac"><i class="fa fa-link" aria-hidden="true"></i></a>1.7. MAC</h2>
<p><strong>&#x4F5C;&#x7528;&#xFF1A;&#x7528;&#x6765;&#x786E;&#x8BA4;&#x7F51;&#x7EDC;&#x8BBE;&#x5907;&#x4F4D;&#x7F6E;&#x7684;&#x4F4D;&#x5740;&#xFF0C;<code>MAC</code>&#x5730;&#x5740;&#x7528;&#x4E8E;&#x5728;&#x7F51;&#x7EDC;&#x4E2D;&#x552F;&#x4E00;&#x6807;&#x793A;&#x4E00;&#x4E2A;&#x7F51;&#x5361;&#xFF0C;&#x4E00;&#x53F0;&#x8BBE;&#x5907;&#x82E5;&#x6709;&#x4E00;&#x6216;&#x591A;&#x4E2A;&#x7F51;&#x5361;&#xFF0C;&#x5219;&#x6BCF;&#x4E2A;&#x7F51;&#x5361;&#x90FD;&#x9700;&#x8981;&#x5E76;&#x4F1A;&#x6709;&#x4E00;&#x4E2A;&#x552F;&#x4E00;&#x7684;<code>MAC</code>&#x5730;&#x5740;</strong></p>
<p><span style="font-size:24px;font-weight:bold" class="section2">1. &#x5C40;&#x57DF;&#x7F51;</span></p>
<p><strong>&#x7279;&#x70B9;&#xFF1A;</strong></p>
<ul>
<li>&#x6240;&#x6709;&#x8BA1;&#x7B97;&#x673A;&#x5747;&#x8FDE;&#x63A5;&#x5728;&#x4E00;&#x4E2A;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x4E0A;</li>
<li>&#x540C;&#x4E00;&#x5C40;&#x57DF;&#x7F51;&#x4E0B;&#x7684;&#x6240;&#x6709;&#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D;&#x4E00;&#x6837;&#xFF0C;&#x300C;&#x5B50;&#x7F51;&#x63A9;&#x7801;&#x300D;&#x4E00;&#x6837;</li>
<li><strong>&#x6EE1;&#x8DB3;&#x524D;&#x9762;&#x4E24;&#x4E2A;&#x6761;&#x4EF6;&#xFF0C;&#x5C40;&#x57DF;&#x7F51;&#x624D;&#x80FD;&#x901A;&#x8BAF;</strong></li>
<li>&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x4F1A;&#x8BB0;&#x5F55;&#x540C;&#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D;&#x4E0B;&#xFF0C;&#x6240;&#x6709;&#x4E3B;&#x673A;&#x7684;&#x300C;MAC&#x5730;&#x5740;&#x300D;</li>
</ul>
<p style="text-align:center;"><a href="../../image/tcp_ip/lan.png" data-lightbox="9de5708e-9f30-4609-8405-4d744ebf5826" data-title="undefined"><img src="../../image/tcp_ip/lan.png" alt="undefined"></a></p>

<p><span style="font-size:24px;font-weight:bold" class="section2">2. ARP</span></p>
<p><strong>&#x5B9A;&#x4E49;&#xFF1A;&#x5730;&#x5740;&#x89E3;&#x6790;&#x534F;&#x8BAE;&#xFF0C;&#x5373;ARP&#xFF08;Address Resolution Protocol&#xFF09;&#xFF0C;&#x662F;&#x6839;&#x636E;IP&#x5730;&#x5740;&#x83B7;&#x53D6;&#x7269;&#x7406;&#x5730;&#x5740;&#x7684;&#x4E00;&#x4E2A;<code>TCP/IP</code>&#x534F;&#x8BAE;&#x3002;&#x5904;&#x4E8E;&#x300C;&#x7F51;&#x7EDC;&#x5C42;&#x300D;</strong></p>
<p></p><div class="terminull">
    <div class="terminullMenu">
      <div class="terminullButtons terminullClose"></div>
      <div class="terminullButtons terminullMinimize"></div>
      <div class="terminullButtons terminullZoom"></div>
    </div>
    <div class="terminullScreen">
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">arp -a</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`arp -a`)"></i>
          <span class="terminullOutput"></span>
        
    </div>
</div><p></p>
<p><strong>&#x6848;&#x4F8B;&#xFF1A;<code>pc2</code>&#x60F3;&#x8FDE;&#x63A5;&#x4E0A;<code>pc3</code>&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x77E5;&#x9053;&#x5BF9;&#x65B9;&#x7684;<code>mac</code>&#xFF0C;&#x9700;&#x8981;&#x5B8C;&#x6210;<code>mac</code>&#x67E5;&#x627E;</strong></p>
<ol>
<li><code>pc2</code>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x300C;&#x6570;&#x636E;&#x5305;&#x300D;&#xFF1A;&#x53CC;&#x65B9;&#x7684;IP&#x5730;&#x5740;&#x548C;&#x81EA;&#x5DF1;&#x7684;MAC&#xFF0C;&#x5BF9;&#x65B9;&#x7684;MAC&#x778E;&#x5199;&#x4E00;&#x4E2A; <p style="text-align:center;"><a href="../../image/tcp_ip/arp_createbackage.png" data-lightbox="0a7e8a52-2d68-4c76-9447-242a1f2efc8b" data-title="undefined"><img src="../../image/tcp_ip/arp_createbackage.png" alt="undefined"></a></p></li>
<li>&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x5BF9;&#x6570;&#x636E;&#x5305;&#x8FDB;&#x884C;&#x300C;&#x5E7F;&#x64AD;&#x300D;&#xFF0C;<code>pc3</code>&#x6EE1;&#x8DB3;&#x8981;&#x6C42;&#xFF0C;&#x63A5;&#x6536;&#x6570;&#x636E;&#x5305;&#xFF0C;&#x5176;&#x4ED6;&#x4E3B;&#x673A;&#x65E0;&#x89C6; <p style="text-align:center;"><a href="../../image/tcp_ip/arp_accept.png" data-lightbox="29682362-5aa1-4c6c-96c8-44e1849a5f8a" data-title="undefined"><img src="../../image/tcp_ip/arp_accept.png" alt="undefined"></a></p></li>
<li><code>pc3</code>&#x63A5;&#x6536;&#x5230;<code>pc2</code>&#x7684;&#x67E5;&#x627E;&#x540E;&#xFF0C;&#x5C31;&#x628A;&#x81EA;&#x5DF1;&#x7684;<code>mac</code>&#x6253;&#x5305;&#x53D1;&#x56DE;&#x53BB;&#x3002;&#x6B64;&#x65F6;&#xFF0C;&#x7531;&#x4E8E;&#x4E4B;&#x524D;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x5DF2;&#x7ECF;&#x5C06;<code>pc2</code>&#x7684;<code>mac</code>&#x5730;&#x5740;&#x8BB0;&#x5F55;&#x4E86;&#xFF0C;&#x6240;&#x4EE5;&#x76F4;&#x63A5;&#x53D1;&#x56DE;&#xFF0C;&#x4E0D;&#x7528;&#x5E7F;&#x64AD;&#x4E86;&#x3002; <p style="text-align:center;"><a href="../../image/tcp_ip/apr_reply.png" data-lightbox="de855705-ce9b-43fa-bea2-1cc9a3e86bfd" data-title="undefined"><img src="../../image/tcp_ip/apr_reply.png" alt="undefined"></a></p></li>
<li><code>pc2</code>&#x63A5;&#x6536;&#x5230;&#x4E86;<code>pc3</code>&#x7684;&#x56DE;&#x4FE1;&#xFF0C;&#x5C31;&#x80FD;&#x786E;&#x5B9A;<code>pc3</code>&#x7684;<code>mac</code>&#x5730;&#x5740;&#x4E86;&#x3002;</li>
</ol>
<h1 id="2-&#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;"><a name="2-&#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;" class="anchor-navigation-ex-anchor" href="#2-&#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;</h1>
<p><strong>&#x63CF;&#x8FF0;&#xFF1A;&#x4E24;&#x4E2A;&#x5C40;&#x57DF;&#x7F51;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8DEF;&#x7531;&#x5668;&#x8FDB;&#x884C;&#x8FDE;&#x63A5;&#xFF0C;&#x300C;&#x8DEF;&#x7531;&#x5668;&#x300D;&#x4E5F;&#x53EF;&#x4EE5;&#x770B;&#x4F5C;&#x662F;&#x4E00;&#x4E2A;&#x4E3B;&#x673A;&#xFF0C;&#x5305;&#x542B;&#x4E86;&#x4E24;&#x4E2A;&#x300C;&#x7F51;&#x5361;&#x300D;&#xFF0C;&#x6BCF;&#x5F20;&#x7F51;&#x5361;&#x8FDE;&#x63A5;&#x4E00;&#x4E2A;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x3002;</strong></p>
<p style="text-align:center;"><a href="../../image/tcp_ip/twolan.png" data-lightbox="88a11360-e843-4250-9cf5-3d33c23a0d6d" data-title="undefined"><img src="../../image/tcp_ip/twolan.png" alt="undefined"></a></p>

<p><strong>&#x6848;&#x4F8B;&#xFF1A;<code>pc2</code>&#x7ED9;<code>pc4</code>&#x53D1;&#x6D88;&#x606F;</strong></p>
<ol>
<li><code>pc2</code>&#x5E94;&#x7528;&#x5C42;&#xFF1A;<code>pc2</code>&#x6309;&#x7167;&#x534F;&#x8BAE;&#x89C4;&#x5B9A;&#xFF1A;&#x628A;&#x6570;&#x636E;&#x5199;&#x6210;&#x6807;&#x51C6;&#x534F;&#x8BAE;&#x683C;&#x5F0F;&#x3002;</li>
<li><code>pc2</code>&#x4F20;&#x8F93;&#x5C42;&#xFF1A;&#x5EFA;&#x7ACB;&#x300C;&#x8FDE;&#x63A5;&#x300D;&#xFF0C;&#x628A;&#x6570;&#x636E;&#x6309;&#x7167;&#x89C4;&#x5B9A;&#xFF1A;&#x6253;&#x5305;</li>
<li><code>pc2</code>&#x7F51;&#x7EDC;&#x5C42;&#xFF1A;&#x67E5;&#x8BE2;<code>gateway</code>&#xFF0C;&#x627E;&#x5230;&#x4E0B;&#x4E00;&#x8DF3;&#x8F6C;&#x70B9;&#x7684;<code>IP</code>&#x4E3A;&#x8DEF;&#x7531;&#x5668;&#xFF1A;<code>192.168.1.3</code></li>
<li><code>pc2</code>&#x94FE;&#x8DEF;&#x5C42;&#xFF1A;&#x6839;&#x636E;&#x8DF3;&#x8F6C;&#x70B9;&#x7684;<code>IP</code>&#x67E5;&#x627E;&#x5230;&#x8DEF;&#x7531;&#x5668;&#x5BF9;&#x5E94;&#x7684;<code>mac</code>&#x5730;&#x5740;&#xFF1A;<code>3.3.3</code> <p style="text-align:center;"><a href="../../image/tcp_ip/twolan_send.png" data-lightbox="f105d312-e21f-4935-a9b2-299f47210762" data-title="undefined"><img src="../../image/tcp_ip/twolan_send.png" alt="undefined"></a></p></li>
<li>&#x901A;&#x8FC7;&#x7B2C;&#x4E00;&#x4E2A;&#x4EA4;&#x6362;&#x673A;&#xFF0C;&#x6570;&#x636E;&#x5C31;&#x53D1;&#x7ED9;&#x4E86;&#x300C;&#x8DEF;&#x7531;&#x5668;&#x300D;</li>
<li>&#x300C;&#x8DEF;&#x7531;&#x5668;&#x300D;&#x63A5;&#x6536;&#x5230;&#x6570;&#x636E;&#x540E;&#xFF0C;&#x53C8;&#x91CD;&#x590D;&#x4E0A;&#x9762;&#x6B65;&#x9AA4;&#xFF0C;&#x627E;&#x4E0B;&#x4E00;&#x8DF3;&#x8F6C;&#x70B9;&#xFF0C;&#x4FEE;&#x6539;<code>mac</code>&#xFF0C;&#x901A;&#x8FC7;&#x7B2C;&#x4E8C;&#x4E2A;&#x4EA4;&#x6362;&#x673A;&#x53D1;&#x9001;&#x7ED9;<code>pc 4</code> <p style="text-align:center;"><a href="../../image/tcp_ip/twolan_gateway.png" data-lightbox="c96f3f37-76fa-4a77-adda-b7750008e0d9" data-title="undefined"><img src="../../image/tcp_ip/twolan_gateway.png" alt="undefined"></a></p>

</li>
</ol>
<blockquote>
<p>[!note|style:flat]
<strong>&#x901A;&#x8BAF;&#x8FC7;&#x7A0B;&#xFF1A;</strong></p>
<ul>
<li><code>IP</code>&#xFF1A;&#x5728;&#x6570;&#x636E;&#x4F20;&#x8F93;&#x4E2D;&#xFF0C;&#x4E0D;&#x4F1A;&#x6539;&#x53D8;&#xFF0C;&#x4EE3;&#x8868;&#x7740;&#x901A;&#x8BAF;&#x7684;&#x4E24;&#x4E2A;&#x300C;&#x7AEF;&#x70B9;&#x300D;</li>
<li><code>mac</code>: &#x5728;&#x5730;&#x5740;&#x5F80;&#x4E0B;&#x4E00;&#x4E2A;&#x70B9;&#x8DF3;&#x8F6C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x88AB;&#x4FEE;&#x6539;&#xFF1B;&#x4EE3;&#x8868;&#x7740;&#x901A;&#x8BAF;&#x4E2D;&#x7684;&#x300C;&#x8282;&#x70B9;&#x300D;</li>
</ul>
<p><strong>&#x8DEF;&#x7531;&#x5668;&#x4E0E;&#x4EA4;&#x6362;&#x673A;&#xFF1A;</strong></p>
<ul>
<li><strong>&#x4EA4;&#x6362;&#x673A;&#xFF1A;</strong> &#x6D89;&#x53CA;&#x300C;&#x94FE;&#x8DEF;&#x5C42;&#x300D;&#x4E0E;&#x300C;&#x7269;&#x7406;&#x5C42;&#x300D;&#xFF1B;&#x5B58;&#x50A8;&#x300C;arp&#x8868;&#x300D;</li>
<li><strong>&#x8DEF;&#x7531;&#x5668;&#xFF1A;</strong> &#x6D89;&#x53CA;&#x300C;&#x7F51;&#x7EDC;&#x5C42;&#x300D;&#xFF0C;&#x300C;&#x94FE;&#x8DEF;&#x5C42;&#x300D;&#x4E0E;&#x300C;&#x7269;&#x7406;&#x5C42;&#x300D;&#xFF1B;&#x5B58;&#x50A8;&#x300C;IP&#x8DEF;&#x7531;&#x8868;&#x300D;</li>
<li><strong>&#x5982;&#x4ECA;&#x5B9E;&#x7269;&#x300C;&#x8DEF;&#x7531;&#x5668;&#x300D;&#xFF0C;&#x5176;&#x5B9E;&#x662F;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x529F;&#x80FD;&#x300D;&#x548C;&#x300C;&#x8DEF;&#x7531;&#x5668;&#x529F;&#x80FD;&#x300D;&#x7684;&#x7ED3;&#x5408;&#x4F53;&#x3002;</strong></li>
<li><strong>&#x4E3B;&#x673A;&#xFF1A;</strong> &#x5168;&#x90E8;&#xFF1B;&#x300C;arp&#x8868;&#x300D;&#x4E0E;&#x300C;IP&#x8DEF;&#x7531;&#x8868;&#x300D;&#x90FD;&#x4F1A;&#x50A8;&#x5B58;&#x3002;</li>
</ul>
<p><strong>&#x4E92;&#x8054;&#x7F51;&#xFF1A;</strong></p>
<ul>
<li>&#x591A;&#x51C6;&#x5907;&#x51E0;&#x4E2A;&#x4EA4;&#x6362;&#x673A;&#x5C40;&#x57DF;&#x7F51;&#xFF0C;&#x591A;&#x8FDE;&#x63A5;&#x51E0;&#x4E2A;&#x8DEF;&#x7531;&#x5668;&#xFF0C;&#x7136;&#x540E;&#x628A;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x8D77;&#x6765;&#x3002;</li>
</ul>
</blockquote>
<h1 id="3-&#x5355;&#x81C2;&#x8DEF;&#x7531;"><a name="3-&#x5355;&#x81C2;&#x8DEF;&#x7531;" class="anchor-navigation-ex-anchor" href="#3-&#x5355;&#x81C2;&#x8DEF;&#x7531;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x5355;&#x81C2;&#x8DEF;&#x7531;</h1>
<p style="text-align:center;"><a href="../../image/tcp_ip/single.png" data-lightbox="0c10dd02-471a-435c-a007-02416349216c" data-title="undefined"><img src="../../image/tcp_ip/single.png" alt="undefined"></a></p>

<ul>
<li><strong>&#x95EE;&#x9898;&#xFF1A;&#x4E24;&#x4E2A;&#x4E0D;&#x540C;&#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D;&#x7684;&#x4E3B;&#x673A;&#xFF08;&#x7F51;&#x7EBF;&#xFF09;&#xFF0C;&#x63D2;&#x5230;&#x4E86;&#x540C;&#x4E00;&#x4E2A;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x4E0A;&#xFF0C;&#x76F4;&#x63A5;&#x5B9E;&#x73B0;<code>pc2</code>&#x4E0E;<code>pc1</code>&#x7684;&#x901A;&#x8BAF;&#x3002;&#x8FD9;&#x4E2A;&#x662F;&#x884C;&#x4E0D;&#x901A;&#x7684;&#xFF0C;&#x4E24;&#x4E2A;&#x4E3B;&#x673A;&#x7684;&#x300C;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x300D;&#x4E0D;&#x4E00;&#x6837;&#xFF0C;&#x65E0;&#x6CD5;&#x5229;&#x7528;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x6784;&#x6210;&#x300C;&#x5C40;&#x57DF;&#x7F51;&#x300D;&#x3002;</strong></li>
<li><strong>&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF1A;&#x5728;&#x4EA4;&#x6362;&#x673A;&#x4E0A;&#xFF0C;&#x518D;&#x63D2;&#x5165;&#x4E00;&#x4E2A;&#x300C;&#x8DEF;&#x7531;&#x5668;&#x300D;&#xFF08;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x53E6;&#x4E00;&#x53F0;<code>pc</code>&#x5B9E;&#x73B0;&#xFF09;&#x3002;&#x5728;&#x8DEF;&#x7531;&#x5668;pc&#x4E0A;&#x5206;&#x522B;&#x4E3A;&#x4E24;&#x4E2A;&#x7F51;&#x7EDC;&#x5730;&#x5740;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x7F51;&#x5361;&#xFF08;&#x4E00;&#x4E2A;&#x7269;&#x7406;&#x7F51;&#x5361;&#xFF0C;&#x53EF;&#x4EE5;&#x914D;&#x7F6E;&#x591A;&#x4E2A;&#x5B57;&#x7F51;&#x6BB5;&#xFF09;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x80FD;&#x95F4;&#x63A5;&#x5B9E;&#x73B0;<code>pc1</code>&#x4E0E;<code>pc2</code>&#x7684;&#x901A;&#x8BAF;&#x4E86;&#x3002;</strong></li>
</ul>
<h1 id="4-tcpip"><a name="4-tcpip" class="anchor-navigation-ex-anchor" href="#4-tcpip"><i class="fa fa-link" aria-hidden="true"></i></a>4. TCP/IP</h1>
<h2 id="41-tcpip-&#x534F;&#x8BAE;&#x6A21;&#x578B;"><a name="41-tcpip-&#x534F;&#x8BAE;&#x6A21;&#x578B;" class="anchor-navigation-ex-anchor" href="#41-tcpip-&#x534F;&#x8BAE;&#x6A21;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1. TCP/IP &#x534F;&#x8BAE;&#x6A21;&#x578B;</h2>
<p><strong>&#x5B9A;&#x4E49;&#xFF1A;&#x53CC;&#x65B9;&#x901A;&#x8BAF;&#x7684;&#x7EA6;&#x5B9A;&#xFF0C;&#x4E24;&#x8FB9;&#x90FD;&#x80FD;&#x770B;&#x5F97;&#x61C2;&#x3002;</strong></p>
<p style="text-align:center;"><a href="../../image/tcp_ip/model.png" data-lightbox="88a05bc1-3ab3-470e-8311-ce0ff02b9418" data-title="undefined"><img src="../../image/tcp_ip/model.png" alt="undefined"></a></p>

<p style="text-align:center;"><a href="../../image/tcp_ip/tcp_protocol.jpg" data-lightbox="aae8259c-d682-4556-9171-ed8ec1a2e6f7" data-title="undefined"><img src="../../image/tcp_ip/tcp_protocol.jpg" alt="undefined"></a></p>

<p><strong>&#x5404;&#x5C42;&#x4F5C;&#x7528;&#xFF1A;</strong></p>
<ol>
<li>&#x5E94;&#x7528;&#x5C42;&#xFF1A;&#x51C6;&#x5907;&#x534F;&#x8BAE;&#x7684;&#x5177;&#x4F53;&#x5185;&#x5BB9;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;&#x51C6;&#x5907;<code>HTTP</code>&#x534F;&#x8BAE;&#x7684;&#x8BF7;&#x6C42;&#x5934;<code>GET / HTTP/1.0 \n</code></li>
<li>&#x4F20;&#x8F93;&#x5C42;&#xFF1A;&#x4F7F;&#x7528;<code>TCP UDP</code>&#x51C6;&#x5907;&#x8981;&#x53D1;&#x9001;&#x7684;&#x300C;&#x6570;&#x636E;&#x5305;&#x300D;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;<code>syn,ack</code>&#x8FD9;&#x4E9B;&#x6570;&#x636E;&#x5305;</li>
<li>&#x7F51;&#x7EDC;&#x4E92;&#x8FDE;&#x5C42;&#xFF1A;&#x6839;&#x636E;&#x8DEF;&#x7531;&#x8868;&#xFF0C;&#x5BFB;&#x627E;&#x7F51;&#x5173;<code>gateway</code>&#xFF0C;&#x5F97;&#x5230;&#x4E0B;&#x4E00;&#x4E2A;&#x8DF3;&#x8F6C;&#x70B9;&#x7684;IP</li>
<li>&#x94FE;&#x8DEF;&#x5C42;&#xFF1A;&#x901A;&#x8FC7;<code>arp</code>&#x67E5;&#x8BE2;&#x4E0B;&#x4E00;&#x4E2A;&#x8DF3;&#x8F6C;&#x70B9;&#x7684;<code>mac</code>&#xFF0C;&#x6DFB;&#x52A0;&#x5230;&#x300C;&#x6570;&#x636E;&#x5305;&#x300D;&#x4E0A;</li>
<li>&#x7269;&#x7406;&#x5C42;&#xFF1A;&#x5728;&#x300C;&#x6570;&#x636E;&#x5305;&#x300D;&#x524D;&#x9762;&#x6DFB;&#x52A0;&#x300C;&#x524D;&#x5BFC;&#x7801;&#x300D;&#xFF0C;&#x7528;&#x4E8E;&#x300C;&#x4EA4;&#x6362;&#x673A;&#x300D;&#x8BC6;&#x522B;&#x300C;&#x6570;&#x636E;&#x5305;&#x300D;</li>
</ol>
<h2 id="42-&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;"><a name="42-&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;" class="anchor-navigation-ex-anchor" href="#42-&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;"><i class="fa fa-link" aria-hidden="true"></i></a>4.2. &#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x6848;&#x4F8B;</h2>
<p></p><div class="terminull">
    <div class="terminullMenu">
      <div class="terminullButtons terminullClose"></div>
      <div class="terminullButtons terminullMinimize"></div>
      <div class="terminullButtons terminullZoom"></div>
    </div>
    <div class="terminullScreen">
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">exec 8&lt;&gt; /dev/tcp/www.baidu.com/80</span>
           
            <span class="terminullComment"># kernel &#x8FDE;&#x63A5;</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`exec 8&lt;&gt; /dev/tcp/www.baidu.com/80`)"></i>
          <span class="terminullOutput"></span>
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">echo -e &apos;GET / HTTP/1.0\n&apos; 1&gt;&amp; 8</span>
           
            <span class="terminullComment"># &#x7528;&#x6237;&#x5C42;&#xFF0C;&#x51C6;&#x5907;&#x534F;&#x8BAE;</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`echo -e &apos;GET / HTTP/1.0\n&apos; 1&gt;&amp; 8`)"></i>
          <span class="terminullOutput"></span>
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">cat 0&lt;&amp; 8</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`cat 0&lt;&amp; 8`)"></i>
          <span class="terminullOutput">HTTP/1.0 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Content-Length: 14615
Content-Type: text/html
....</span>
        
    </div>
</div><p></p>
<p><code>exec 8&lt;&gt; /dev/tcp/www.baidu.com/80</code>:</p>
<ul>
<li><code>8</code>:&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;</li>
<li><code>/dev/tcp/www.baidu.com/80</code>:&#x7F51;&#x9875;&#x5730;&#x5740;</li>
</ul>
<p><code>&apos;GET / HTTP/1.0\n&apos;</code>: &#x8BF7;&#x6C42;&#x5934;</p>
<ul>
<li><code>GET</code>:&#x8BF7;&#x6C42;</li>
<li><code>HTTP/1.0</code>:&#x534F;&#x8BAE;&#x7248;&#x672C;</li>
</ul>
<blockquote>
<p>[!note]</p>
<ol>
<li><code>client</code> &#x4E0E; <code>server</code>&#x9996;&#x5148;&#x5EFA;&#x7ACB;&#x8FDE;&#x63A5;<ul>
<li>&#x300C;&#x8FDE;&#x63A5;&#x300D;&#x662F;&#x4E0D;&#x4F1A;&#x65AD;&#x5F00;&#x7684;</li>
<li>&#x300C;&#x8D85;&#x65F6;&#x300D;&#x662F;&#x5148;&#x300C;&#x8FDE;&#x63A5;&#x300D;&#x6210;&#x529F;&#x540E;&#xFF0C;&#x7528;&#x6237;&#x4E0D;&#x53D1;&#x9001;&#x8BF7;&#x6C42;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x81EA;&#x5DF1;&#x628A;&#x8FDE;&#x63A5;&#x7ED9;&#x65AD;&#x6389;&#x3002;</li>
</ul>
</li>
<li>&#x8FDE;&#x63A5;&#x6210;&#x529F;&#x540E;&#xFF0C;&#x9700;&#x8981;&#x4F20;&#x8F93;&#x67D0;&#x79CD;&#x534F;&#x8BAE;</li>
</ol>
</blockquote>
<h1 id="5-tcp&#x534F;&#x8BAE;"><a name="5-tcp&#x534F;&#x8BAE;" class="anchor-navigation-ex-anchor" href="#5-tcp&#x534F;&#x8BAE;"><i class="fa fa-link" aria-hidden="true"></i></a>5. <code>TCP</code>&#x534F;&#x8BAE;</h1>
<blockquote>
<p>[!note]</p>
<ol>
<li>&#x4F20;&#x8F93;&#x5C42;&#x8FDB;&#x884C;</li>
<li>&#x9762;&#x5411;&#x300C;&#x8FDE;&#x63A5;&#x300D;</li>
<li>&#x300C;&#x53EF;&#x9760;&#x300D;&#x7684;&#x4F20;&#x8F93;&#x8FDE;&#x63A5;</li>
</ol>
</blockquote>
<p><span style="font-size:24px;font-weight:bold" class="section2">1. &#x8FDE;&#x63A5;&#x4E0E;&#x4E09;&#x6B21;&#x63E1;&#x624B;</span></p>
<p style="text-align:center;"><a href="../../image/tcp_ip/link.png" data-lightbox="d13cda89-fc95-4ed1-a9f9-b91d837d3a53" data-title="undefined"><img src="../../image/tcp_ip/link.png" alt="undefined"></a></p>

<blockquote>
<p>[!note]
<strong>&#x4E09;&#x6B21;&#x63E1;&#x624B;&#xFF1A;&#x53EA;&#x662F;&#x4F20;&#x8F93;&#x5C42;&#x6D4B;&#x8BD5;&#x7528;&#xFF0C;&#x548C;&#x7528;&#x6237;&#x5C42;&#x6CA1;&#x5173;&#x7CFB;</strong></p>
<ol>
<li>C &#x53D1;&#x9001;&#x4E00;&#x4E2A; <code>syn</code> &#x7ED9; S</li>
<li>S &#x6536;&#x5230;&#x540E;&#xFF0C;&#x53D1;&#x9001;<code>syn</code>&#x548C;<code>ack</code>&#x7ED9; C</li>
<li>C &#x6536;&#x5230;&#x540E;&#xFF0C;&#x53D1;&#x9001;&#x4E00;&#x4E2A;<code>ack</code>&#x7ED9; S</li>
<li>1 &#x548C; 2 &#xFF1A; C &#x786E;&#x8BA4;&#x7684;&#x6536;&#x53D1;&#x901A;&#x9053;&#x7684;&#x6B63;&#x5E38;</li>
<li>2 &#x548C; 3 &#xFF1A; S &#x786E;&#x8BA4;&#x4E86;&#x6536;&#x53D1;&#x901A;&#x9053;&#x7684;&#x6B63;&#x5E38;</li>
</ol>
<p><strong>&#x5F00;&#x8F9F;&#x8D44;&#x6E90;</strong></p>
<ul>
<li><strong>&#x5728;&#x5B8C;&#x6210;&#x8FDE;&#x63A5;&#x540E;&#xFF0C;<code>S C</code>&#x4F1A;&#x5206;&#x522B;&#x5F00;&#x8F9F;&#x8D44;&#x6E90;&#xFF0C;&#x7B49;&#x5F85;&#x6B63;&#x5F0F;&#x901A;&#x8BAF;&#x3002;</strong></li>
</ul>
<p><strong>&#x5B8C;&#x6210;&#x300C;&#x4E09;&#x6B21;&#x63E1;&#x624B;&#x300D;&#x548C;&#x300C;&#x8D44;&#x6E90;&#x5F00;&#x8F9F;&#x300D;&#x540E;&#xFF0C;&#x4E00;&#x4E2A;&#x300C;<code>TCP</code>&#x8FDE;&#x63A5;&#x300D;&#x624D;&#x7B97;&#x6B63;&#x5F0F;&#x6210;&#x7ACB;&#x3002;&#x5F53;&#x524D;&#x7684;&#x300C;&#x8FDE;&#x63A5;&#x300D;&#x662F;&#x865A;&#x62DF;&#x7684;&#xFF0C;&#x6CA1;&#x6709;&#x5B9E;&#x8D28;&#x6027;&#x7684;&#x4FDD;&#x969C;&#xFF0C;&#x6307;&#x4E0D;&#x5B9A;&#x5565;&#x65F6;&#x5019;&#x5BF9;&#x65B9;&#x5C31;&#x6302;&#x4E86;&#xFF0C;&#x6240;&#x4EE5;&#x8FD8;&#x9700;&#x8981;&#x989D;&#x5916;&#x624B;&#x6BB5;&#x4FDD;&#x8BC1;&#x300C;&#x8FDE;&#x63A5;&#x300D;&#x7684;&#x6709;&#x6548;&#x6027;&#x3002;</strong></p>
</blockquote>
<p><span style="font-size:24px;font-weight:bold" class="section2">2. &#x53EF;&#x9760;</span></p>
<p><strong>&#x300C;&#x4E09;&#x6B21;&#x63E1;&#x624B;&#x300D;&#x4E2D;&#xFF0C;&#x5C31;&#x5B58;&#x5728;<code>syn</code>&#x4E0E;<code>ack</code>&#x6536;&#x53D1;&#x786E;&#x8BA4;&#xFF0C;&#x8FD9;&#x4E2A;&#x4FDD;&#x8BC1;&#x4E86;&#xFF0C;&#x901A;&#x8BAF;&#x7684;&#x300C;&#x53EF;&#x9760;&#x300D;&#x3002;</strong></p>
<p><span style="font-size:24px;font-weight:bold" class="section2">3. &#x56DB;&#x6B21;&#x5206;&#x624B;</span></p>
<p style="text-align:center;"><a href="../../image/tcp_ip/break.png" data-lightbox="d1be554e-383b-4129-b4ff-9c53d5c92a2f" data-title="undefined"><img src="../../image/tcp_ip/break.png" alt="undefined"></a></p>

<blockquote>
<ol>
<li>C &#x53D1;&#x4E00;&#x4E2A; <code>fin</code> &#x7ED9; S&#xFF1A;&#x901A;&#x77E5;&#x8981;&#x65AD;&#x5F00;</li>
<li>S &#x53D1; <code>ack</code> &#x7ED9; C&#xFF1A;&#x56DE;&#x5E94;&#x4E00;&#x4E0B;&#xFF0C;&#x4E0D;&#x4EE3;&#x8868;&#x540C;&#x610F;&#x65AD;&#x5F00;</li>
<li>&#x7136;&#x540E; S &#x5F00;&#x59CB;&#x6536;&#x5C3E;&#x5DE5;&#x4F5C;&#xFF0C; &#x53EF;&#x80FD;&#x8FD8;&#x6709;&#x6570;&#x636E;&#x6CA1;&#x6709;&#x4F20;&#x8F93;&#x5B8C;&#xFF0C;C &#x8FD8;&#x662F;&#x53EF;&#x4EE5;&#x63A5;&#x6536;&#x6570;&#x636E;&#x3002;</li>
<li>&#x6536;&#x5C3E;&#x5B8C;&#x6BD5;&#xFF0C;S &#x6B63;&#x5F0F;&#x56DE;&#x5E94;&#x4E00;&#x4E2A;<code>fin</code>&#xFF1A;&#x8868;&#x793A;&#x53EF;&#x4EE5;&#x65AD;&#x5F00;&#x4E86;</li>
<li>C &#x56DE;&#x590D;&#x4E00;&#x4E2A;<code>ack</code></li>
<li>&#x6700;&#x540E;&#x53CC;&#x65B9;&#x5F00;&#x59CB;<code>close</code>&#x56DE;&#x6536;&#x8D44;&#x6E90;&#x3002;</li>
<li><code>fin</code>: &#x8868;&#x793A;&#x540E;&#x9762;&#x6CA1;&#x6709;&#x6570;&#x636E;&#x9700;&#x8981;&#x53D1;&#x9001;&#xFF0C;&#x901A;&#x5E38;&#x610F;&#x6627;&#x7740;&#x6240;&#x5EFA;&#x7ACB;&#x7684;&#x8FDE;&#x63A5;&#x9700;&#x8981;&#x5173;&#x95ED;&#x4E86;&#x3002;</li>
</ol>
</blockquote>
<p><span style="font-size:24px;font-weight:bold" class="section2">4. &#x6848;&#x4F8B;&#x6D4B;&#x8BD5;</span></p>
<p></p><div class="terminull">
    <div class="terminullMenu">
      <div class="terminullButtons terminullClose"></div>
      <div class="terminullButtons terminullMinimize"></div>
      <div class="terminullButtons terminullZoom"></div>
    </div>
    <div class="terminullScreen">
        
          <span class="terminullDirectory">triangle@LEARN_FUCK:~</span>$ 
          <span class="terminullCommand">sudo tcpdump -i ens192 port 80</span>
          
          <i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`sudo tcpdump -i ens192 port 80`)"></i>
          <span class="terminullOutput">tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens192, link-type EN10MB (Ethernet), capture size 262144 bytes

# &#x4E09;&#x6B21;&#x63E1;&#x624B;
18:06:03.191110 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [S], seq 2295567055, win 29200, options [mss 1460,sackOK,TS val 1364799231 ecr 0,nop,wscale 7], length 0
18:06:03.224702 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [S.], seq 4189444164, ack 2295567056, win 8192, options [mss 1400,sackOK,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,wscale 5], length 0
18:06:03.224755 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [.], ack 1, win 229, length 0

# &#x53D1;&#x9001; http &#x8BF7;&#x6C42;&#x5934;
18:06:03.231241 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [P.], seq 1:78, ack 1, win 229, length 77: HTTP: GET / HTTP/1.1
18:06:03.265447 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [.], ack 78, win 908, length 0

# &#x767E;&#x5EA6;&#x53D1;&#x7F51;&#x9875;&#x56DE;&#x6765;&#xFF1A;&#x5206;&#x4E86;&#x4E24;&#x6B21;&#x53D1;&#x9001;
18:06:03.267423 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [.], seq 1:1401, ack 78, win 908, length 1400: HTTP: HTTP/1.1 200 OK
18:06:03.267439 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [.], ack 1401, win 251, length 0
18:06:03.267468 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [P.], seq 1401:2782, ack 78, win 908, length 1381: HTTP
18:06:03.267481 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [.], ack 2782, win 274, length 0

# &#x56DB;&#x6B21;&#x6325;&#x624B;
18:06:03.269671 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [F.], seq 78, ack 2782, win 274, length 0

# &#x8FD8;&#x6709;&#x6570;&#x636E;&#x6CA1;&#x53D1;&#x5B8C;&#xFF0C;&#x63A5;&#x7740;&#x53D1;
18:06:03.276309 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [P.], seq 1401:2782, ack 78, win 908, length 1381: HTTP
18:06:03.276334 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [.], ack 2782, win 274, options [nop,nop,sack 1 {1401:2782}], length 0

18:06:03.303586 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [.], ack 79, win 908, length 0

# &#x8FD9;&#x6B21;&#x6D3B;&#x5E72;&#x5B8C;&#x4E86;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x5F00;&#x59CB;&#x65AD;&#x5F00;
18:06:03.303614 IP 14.215.177.39.http &gt; nginx-hj.41414: Flags [F.], seq 2782, ack 79, win 908, length 0
18:06:03.303638 IP nginx-hj.41414 &gt; 14.215.177.39.http: Flags [.], ack 2783, win 274, length 0</span>
        
    </div>
</div><p></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../tcp_upd.html" class="navigation navigation-prev " aria-label="Previous page: 网络">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="tcp_udp_withNum.html" class="navigation navigation-next " aria-label="Next page: 二、tcp/udp">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"一、网络通讯基础","level":"5.1.1","depth":2,"next":{"title":"二、tcp/udp","level":"5.1.2","depth":2,"path":"tcp_udp/chapter/tcp_udp_withNum.md","ref":"./tcp_udp/chapter/tcp_udp_withNum.md","articles":[]},"previous":{"title":"网络","level":"5.1","depth":1,"path":"tcp_udp/tcp_upd.md","ref":"./tcp_udp/tcp_upd.md","articles":[{"title":"一、网络通讯基础","level":"5.1.1","depth":2,"path":"tcp_udp/chapter/foundation_withNum.md","ref":"./tcp_udp/chapter/foundation_withNum.md","articles":[]},{"title":"二、tcp/udp","level":"5.1.2","depth":2,"path":"tcp_udp/chapter/tcp_udp_withNum.md","ref":"./tcp_udp/chapter/tcp_udp_withNum.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","search-pro-fixed","expandable-chapters-small","ancre-navigation","hide-element","code","splitter","insert-logo-link-website","-sharing","sharing-plus","prism","-highlight","flexible-alerts","lightbox","pageview-count","auto-scroll-table","katex-pro","favicon-absolute","sectionx","terminull-light","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"],"lang":{"flow":"typescript"}},"livereload":{},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"auto-scroll-table":{},"code":{"copyButtons":true},"terminull-light":{},"search-pro-fixed":{},"favicon-absolute":{"favicon":"image/ico.png","appleTouchIconPrecomposed152":"image/ico.png","appleTouchIconMore":{},"appleTouchIconPrecomposedMore":{}},"hide-element":{"elements":[".gitbook-link"]},"katex-pro":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"lightbox":{"jquery":true,"sameUuid":false},"insert-logo-link-website":{"url":"image/logo.png","link":"https://space.bilibili.com/27206875","target":"_blank","style":"height: 230px"},"pageview-count":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"expandable-chapters-small":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"qq":true,"all":["douban","facebook","google","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","whatsapp"],"douban":false,"facebook":false,"weibo":true,"whatsapp":false,"twitter":false,"pocket":false,"google":true,"qzone":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"海拉尔的三角","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"计算机笔记","links":{"sidebar":{"Github":"https://github.com/spite-triangle"}},"gitbook":"*"},"file":{"path":"tcp_udp/chapter/foundation_withNum.md","mtime":"2021-09-14T15:43:13.801Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-14T15:43:23.052Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-terminull-light/terminull.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

